import { Command } from '@/commands/command.ts'
import { new_command } from '@/models/command.ts'

export class DatetimeCommand extends Command {
    public static new(args: string): Command {
        const command = new_command()
        command.args = args
        command.name = 'datetime'
        command.component = 'AllowCopyCommandComponent'

        return new DatetimeCommand(command, false)
    }

    usage(): string {
        return 'datetime [--sub] [-y 年] [-M 月] [-d 日] [-h 时] [-m 分] [-s 秒] [-f 格式] [--from 时间戳 [--mil|--mic]]'
    }

    description(): string {
        return `<div>处理日期时间</div>
        <br/>
        <div>选项说明:</div>
        <br/>
        <div><span class="option-option">--sub</span><span>指定此参数时将减去给定的年月日时分秒</span></div>
        <br/>
        <div class="option-row"><span class="option-option">-y --years</span><span>加减年份</span></div>
        <div class="option-row"><span class="option-option">-M --months</span><span>加减月份</span></div>
        <div class="option-row"><span class="option-option">-d --days</span><span>加减日</span></div>
        <div class="option-row"><span class="option-option">-h --hours</span><span>加减小时</span></div>
        <div class="option-row"><span class="option-option">-m --minutes</span><span>加减分钟</span></div>
        <div class="option-row"><span class="option-option">-s --seconds</span><span>加减秒</span></div>
        <div class="option-row"><span class="option-option">-f --format</span><span>时间日期格式，默认为%Y-%m-%d %H:%M:%S，如需自定义格式请查询rust语言时间格式占位符</span></div>
        <div class="option-row"><span class="option-option">--from</span><span>使用指定的时间戳，单位秒</span></div>
        <div class="option-row"><span class="option-option">--mil</span><span>指定时间戳的单位为毫秒，仅在制定了--from时有效</span></div>
        <div class="option-row"><span class="option-option">--mic</span><span>指定时间戳的单位为微秒，仅在制定了--from时有效</span></div>`
    }
}
